mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-01 02:03:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			51 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <pre>
 | |
| DataFrame <code>students</code>
 | |
| +-------------+--------+
 | |
| | Column Name | Type   |
 | |
| +-------------+--------+
 | |
| | id          | int    |
 | |
| | first       | object |
 | |
| | last        | object |
 | |
| | age         | int    |
 | |
| +-------------+--------+
 | |
| </pre>
 | |
| 
 | |
| <p>编写一个解决方案,按以下方式重命名列:</p>
 | |
| 
 | |
| <ul>
 | |
| 	<li><code>id</code> 重命名为 <code>student_id</code></li>
 | |
| 	<li><code>first</code> 重命名为 <code>first_name</code></li>
 | |
| 	<li><code>last</code> 重命名为 <code>last_name</code></li>
 | |
| 	<li><code>age</code> 重命名为 <code>age_in_years</code></li>
 | |
| </ul>
 | |
| 
 | |
| <p>返回结果格式如下示例所示。</p>
 | |
| 
 | |
| <p> </p>
 | |
| 
 | |
| <p><strong>示例 1:</strong></p>
 | |
| 
 | |
| <pre>
 | |
| <strong>输入:
 | |
| </strong>+----+---------+----------+-----+
 | |
| | id | first   | last     | age |
 | |
| +----+---------+----------+-----+
 | |
| | 1  | Mason   | King     | 6   |
 | |
| | 2  | Ava     | Wright   | 7   |
 | |
| | 3  | Taylor  | Hall     | 16  |
 | |
| | 4  | Georgia | Thompson | 18  |
 | |
| | 5  | Thomas  | Moore    | 10  |
 | |
| +----+---------+----------+-----+
 | |
| <b>输出:</b>
 | |
| +------------+------------+-----------+--------------+
 | |
| | student_id | first_name | last_name | age_in_years |
 | |
| +------------+------------+-----------+--------------+
 | |
| | 1          | Mason      | King      | 6            |
 | |
| | 2          | Ava        | Wright    | 7            |
 | |
| | 3          | Taylor     | Hall      | 16           |
 | |
| | 4          | Georgia    | Thompson  | 18           |
 | |
| | 5          | Thomas     | Moore     | 10           |
 | |
| +------------+------------+-----------+--------------+
 | |
| <b>解释:</b>
 | |
| 列名已相应更换。</pre>
 |